<!DOCTYPE html>
<html>
    
    <head>
        <title>{$Think.config.app_name}</title>
        {include file="public/head_frame"/}
    </head>
    <body class="layui-layout-body">
        <div id="LAY_app" class="layadmin-tabspage-none">
            <div class="root_box" id="LAY_app_body" v-cloak>
                <form class="layui-form" action="" lay-filter="example">
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">user</label>
                        <div class="layui-input-block">
                            <input type="text" placeholder="请输入user" class="layui-input" v-model="item.code_user">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">code</label>
                        <div class="layui-input-block">
                            <input type="text" placeholder="请输入code" class="layui-input" v-model="item.code_code">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button type="button" class="layui-btn" @click="submit">立即提交</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </body>
    {include file="public/foot_frame"/}
    <script>
    var app = new Vue({
        el: ".root_box",
        data: {
            item:{}
        },
        created() {
            $.post("/api/code/detail", Object.assign(this.item,PostCommon), function (data, status) {
                _hideLoading();
                console.log(data);
                if (data.code != 0) {
                    _alert(data.msg);
                } else {
                    this.item = data.data;
                }
            });
        },
        methods: {
            submit: function () {
                _loading();
                $.post("/api/code/update", Object.assign(this.item,PostCommon), function (data, status) {
                    _hideLoading();
                    console.log(data);
                    if (data.code != 0) {
                        _alert(data.msg);
                    } else {
                        parent.closewindow();
                    }
                });
            },
        }
    });
    </script>

</html>